package com.msj.goods.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.msj.goods.common.utils.ShiroUtils;
import com.msj.goods.entity.SysUser;
import com.msj.goods.entity.XwIntegral;
import com.msj.goods.mapper.XwIntegralMapper;
import com.msj.goods.service.XwIntegralService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 行为c积分管理 服务实现类
 * </p>
 *
 * @author sun li
 * @since 2018-11-05
 */
@Service
public class XwIntegralServiceImpl extends ServiceImpl<XwIntegralMapper, XwIntegral> implements XwIntegralService {


    /**
     *  查询个人部门下所有的行为积分项
     */
    @Override
    public PageInfo<XwIntegral> selectDeptIntegral(String pageSize,String pageNum,String search) {
        //分页
        PageHelper.startPage(Integer.parseInt(pageNum) ,Integer.parseInt(pageSize));
        SysUser user = ShiroUtils.getUserEntity();
        EntityWrapper<XwIntegral> ew = new EntityWrapper<>();
        ew.eq("dept_id", user.getDeptId());
        ew.like("behavior_title",search);
        List<XwIntegral>  list = this.baseMapper.selectList(ew);

        return new PageInfo<>(list);
    }
}
